package com.digiproto.app_store.adapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.digiproto.app_store.fragment.GameDetailFragment;
import com.digiproto.app_store.model.Game;

import java.util.List;

/**
 * Created by TreeNode on 2017/11/10.
 */

public class GameDetailFragmentAdapter extends FragmentPagerAdapter {

    private Fragment gameDetailFragment;
    private Game thisGame;

    public GameDetailFragmentAdapter(FragmentManager fm , Game game) {
        super(fm);
        Bundle bundle = new Bundle();
        bundle.putSerializable("Game",game);
        gameDetailFragment = new GameDetailFragment();
        gameDetailFragment.setArguments(bundle);
        this.thisGame = game;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return thisGame.getGameName();
    }

    @Override
    public Fragment getItem(int position) {
        return gameDetailFragment;
    }

    @Override
    public int getCount() {
        return 1;
    }
}
